import { useStore as baseUseStore, CommitOptions } from "vuex";
import { key } from "@/store";
import mutations from "@/store/mutations";

export const useStore = () => {
  const store = baseUseStore(key);
  return {
    state: store.state,
    commit(
      type: keyof typeof mutations,
      payload?: any,
      options?: CommitOptions | undefined
    ) {
      store.commit(type, payload, options);
    },
  };
};
